package com.example.demo.innoket.util;

import java.io.File;
import java.io.InputStream;
import java.util.Properties;

/**
 * 各类资源配置
 *
 */
public final class Resources {


	/************mysql 数据库配置 ************/
	public static String DRIVER = "org.gjt.mm.mysql.Driver";
	public static String URL = "jdbc:mysql://localhost:3306/common_finance?characterEncoding=utf-8&rewriteBatchedStatements=true&useSSL=false"; // 数据库访问串
	public static String USERNAME = "root";
	public static String PASSWORD = "310015";

	/************oracle 数据库配置 ************/
/*	public static String DRIVER = "";
	public static String URL = ""; // 数据库访问串
	public static String USERNAME = "";
	public static String PASSWORD = "";*/

	/**作者*/
	public static String AUTHOR = "";

	/************ 模板配置 ************/
	public static String TEMPLATE_PATH = "";
	public static String ENTITY_TEMPLATE = "";
	public static String MODEL_TEMPLATE = "";
	public static String DAO_TEMPLATE = "";
	public static String MAPPER_TEMPLATE = "";
	public static String SERVICE_TEMPLATE = "";
	public static String SERVICE_IMPL_TEMPLATE = "";
	public static String CONTROLLER_TEMPLATE = "";
	public static String CONTROLLER_API_TEMPLATE = "";
	public static String EXPAND_TEMPLATE = "";

	public static String JSP_LIST_FILE_TEMPLATE = "";
	public static String JS_LIST_FILE_TEMPLATE = "";
	public static String PROVIDER_TEMPLATE = "";
	
	public static String JSP_ADD_FILE_TEMPLATE = "";
	public static String JS_ADD_FILE_TEMPLATE = "";
	public static String JSP_VIEW_FILE_TEMPLATE = "";
	public static String JS_VIEW_FILE_TEMPLATE = "";
	public static String CONFIG_TEMPLATE = "";
	public static String RECEVIER_TEMPLATE = "";

	/************
	 * Package 声明,
	 * 如果只声明了BASE_PACKAGE,未声明其它Package
	 * 那么以base_package为基础创建目录/com/**
	 * -entity -model
	 * -dao
	 * -service
	 * --impl
	 * -controller
	 **************/
	public static String BASE_PACKAGE = "";

	/************ controller访问地址 : request_mapping/moudle ****************/
	public static String REQUEST_MAPPING = "";

	public static String VO_PACKAGE =  "";
	/************ JS文件存储地址 ****************/
	public static String JS_FILE_PATH =  "";
	public static String JS_FILE_PACKAGE =  "";
	/************ JSP文件存储地址 ****************/
	public static String JSP_FILE_PATH =  "";
	public static String JSP_FILE_PACKAGE =  "";
	
	/************ 生成JAVA文件的根目录，系统根据package声明进行目录创建 **********/
	public static String JAVA_STROE_PATH = "";

	static {
		Properties prop = new Properties();
		File file = new File("FinanceAccount");
		InputStream in = Object.class.getResourceAsStream("/config.properties");
		try {
			prop.load(in);
			DRIVER = prop.getProperty("driver").trim();
			URL = prop.getProperty("url").trim();
			USERNAME = prop.getProperty("username").trim();
			PASSWORD = prop.getProperty("password").trim();

			AUTHOR = prop.getProperty("author").trim();
			TEMPLATE_PATH = prop.getProperty("template_path").trim();
			ENTITY_TEMPLATE = prop.getProperty("entity_template").trim();
			MODEL_TEMPLATE = prop.getProperty("model_template").trim();
			DAO_TEMPLATE = prop.getProperty("dao_template").trim();
			MAPPER_TEMPLATE = prop.getProperty("mapper_template").trim();
			SERVICE_TEMPLATE = prop.getProperty("service_template").trim();
			SERVICE_IMPL_TEMPLATE = prop.getProperty("service_impl_template").trim();
			CONTROLLER_TEMPLATE = prop.getProperty("controller_template").trim();
			CONFIG_TEMPLATE = prop.getProperty("mq_config_template").trim();
			RECEVIER_TEMPLATE = prop.getProperty("mq_receiver_template").trim();

			CONTROLLER_API_TEMPLATE = prop.getProperty("controller_api_template").trim();
			EXPAND_TEMPLATE = prop.getProperty("expand_template").trim();
			PROVIDER_TEMPLATE = prop.getProperty("provider_template").trim();
			JSP_LIST_FILE_TEMPLATE = prop.getProperty("jsp_list_template").trim();
			JS_LIST_FILE_TEMPLATE = prop.getProperty("js_list_template").trim();
			JSP_ADD_FILE_TEMPLATE = prop.getProperty("jsp_add_template").trim();
			JS_ADD_FILE_TEMPLATE = prop.getProperty("js_add_template").trim();
			JSP_VIEW_FILE_TEMPLATE = prop.getProperty("jsp_view_template").trim();
			JS_VIEW_FILE_TEMPLATE = prop.getProperty("js_view_template").trim();

			BASE_PACKAGE = prop.getProperty("base_package").trim();

			
        	JSP_FILE_PACKAGE = prop.getProperty("jsp_file_package").trim().replace(".","\\");
        	JS_FILE_PACKAGE = prop.getProperty("js_file_package").trim().replace(".","\\");

//			VO_PACKAGE = prop.getProperty("vo_package").trim();
//        	MODEL_PACKAGE = prop.getProperty("model_package").trim();
//        	DAO_PACKAGE = prop.getProperty("dao_package").trim();
//        	MAPPER_PACKAGE = prop.getProperty("mapper_package").trim();
//        	SERVICE_PACKAGE = prop.getProperty("service_package").trim();
//        	CONTROLLER_PACKAGE = prop.getProperty("controller_package").trim();
//
//        	REQUEST_MAPPING = prop.getProperty("request_mapping").trim();
//        	JAVA_STROE_PATH = prop.getProperty("java_stroe_path").trim();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	/**
	 * 私有构造方法，不需要创建对象
	 */
	private Resources() {
	}

	public static String getClazzNameByTableName(String tableName) {
		return tableName;
	}




	public static void main(String[] args) {

		/*System.out.println("jdbc存储地址:" + URL);

		System.out.println("entity存储地址:" + getJavaStorePath(FileType.ENTITY));
		System.out.println("entity包声明:" + getPackage(FileType.ENTITY));

		System.out.println("dao存储地址:" + getJavaStorePath(FileType.DAO));
		System.out.println("dao包声明:" + getPackage(FileType.DAO));

		System.out.println("service存储地址:" + getJavaStorePath(FileType.SERVICE));
		System.out.println("service包声明:" + getPackage(FileType.SERVICE));

		System.out.println("service存储地址:" + getJavaStorePath(FileType.SERVICE_IMPL));
		System.out.println("service包声明:" + getPackage(FileType.SERVICE_IMPL));

		System.out.println("controller存储地址:" + getJavaStorePath(FileType.CONTROLLER));
		System.out.println("controller包声明:" + getPackage(FileType.CONTROLLER));

		System.out.println("jsp存储地址:" + Resources.JSP_STORE_PATH + "/模块名称");*/
	}
}
